package redisclient;


import java.util.ArrayList;
import java.util.List;

// redis-cli
// set key v1
// set key2 v2
public class RedisClientDemo {

    public static void main(String[] args) throws Exception {

        RedisClient redisclient = new RedisClient("localhost", 6379);

        List<Thread> threads = new ArrayList<>();

        for (int i = 0; i < 2; i++) {
            Thread thread = new Thread(() -> {
                RedisConnection connection = redisclient.connection();
                for (String s : new String[]{"key", "key2"}) {
                    System.out.println(s + "=" + connection.get(s));
                }

            });

            thread.start();

            threads.add(thread);
        }

        for (Thread thread : threads) {
            thread.join();
        }

        redisclient.shutdown();
    }

}
